package com.laboratory.sselearning.task;

import com.laboratory.sselearning.service.SseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class HeartbeatTask {

    @Autowired
    private SseService sseService;

    /**
     * 每5秒执行一次
     */
    @Scheduled(fixedRate = 5_000)
    public void beatAll() {
        sseService.beatAll();
    }

}
